// 引入项目中全部的全局组件
import SvgIcon from './GlobalComponents/SvgIcon/index.vue'
// 引入elelment图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import EchartsGlobal from './GlobalComponents/EchartsGlobal/index.vue'
import SimpleTable from './GlobalComponents/SimpleTable/index.vue'

const allGloablComponent = { SvgIcon, EchartsGlobal, SimpleTable }

//对外暴露插件对象
export default {
  // 务必叫做install方法
  install(app: any) {
    // 注册项目全部的全局组件
    Object.keys(allGloablComponent).forEach((key) => {
      // console.log('key:', key)
      // 注册为全局组件
      app.component(key, allGloablComponent[key])
    })
    // 将element图标注册为全局组件
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
  },
}
